import React, {Component} from 'react';
import wpsPreStatus from '../../functions/wpsPreStatus';
import './index.less';

import {
    base,
} from 'nc-lightapp-front';

const {
    NCCheckbox
} = base;

class Header extends Component {
    constructor(props) {
        super(props);
        this.onChangeHandle = this.onChangeHandle.bind(this);
    }


    onChangeHandle(value) {
        console.log('点击控制配置前须知',value)
        this.props.updateState({
            isNeedWpsInterview: value
        });
        console.log(this.props)
        wpsPreStatus({readstatus:value,url:this.props.originUrl})
            .then((res) => {
                if(res.success){
                    console.log('以改变后台')
                }
               
            });
        
    }

    render() {
        const {
            
            json,
            isNeedWpsInterview,
        } = this.props;


        return (
            <div className='multiple-header'>
                {
                    <div className="header-checkbox">
                        <NCCheckbox
                            className="wps-checkbox"
                            color="primary"
                            onChange={this.onChangeHandle}
                            checked={isNeedWpsInterview}
                        >
                            {json["不再弹出设计前配置说明"] || '不再弹出设计前配置说明'}{/* 国际化处理： 不再弹出设计前配置说明 json['hi6007-000354'] || */}
                        </NCCheckbox>
                    </div>
                }
            </div>
        );
    }
}

export default Header;
